package TreesetAndTreemap;

import java.util.Set;
import java.util.TreeMap;

public class TestTreemap01 {

	public static void main(String[] args) {
		Person p1 = new Person("x", 1000);
		Person p2 = new Person("y", 1100);
		Person p3 = new Person("z", 1200);

		TreeMap<Person, String> map = new TreeMap<Person, String>(
				new java.util.Comparator<Person>() {

					public int compare(Person o1, Person o2) {

						return o1.getNumber() - o2.getNumber();
					}

				});

		map.put(p1, "xxxx");
		map.put(p2, "xxxx");
		map.put(p3, "xxxx");

		Set<Person> persons = map.keySet();

		System.out.println(persons);

	}
}
